package com.pactera.asmp.server.schedule;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;

import com.pactera.asmp.server.AsmpserverApplication;
import com.pactera.asmp.server.utils.AsmpAuthUtil;

@Service
@EnableScheduling
public class VerifyAuthSchedule {

    private Logger logger = LoggerFactory.getLogger(VerifyAuthSchedule.class);

    /**
     * 每小时执行一次
     */
    @Scheduled(cron = "0 30 * * * ?")
    public void verify(){
        if(!AsmpAuthUtil.verifyAuth()){
            logger.error("verify auth result is false!!!");
//            AsmpserverApplication.configurableApplicationContext.close();
            return;
        }
    }
}
